package com.youlu.campus.admin.commission.controller;

import com.youlu.campus.admin.commission.service.DistributorGradeAdminService;
import com.youlu.campus.entity.commission.dto.DistributorGradeSaveDTO;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 分销等级
 *
 * @author : [dengbo]
 * @className : DistributorGradeController
 * @description : [描述说明该类的功能]
 * @createTime : [2023/2/3 13:50]
 */
@Slf4j
@RestController
@RequestMapping("/distributor")
public class DistributorGradeAdminController {
    @Autowired
    private DistributorGradeAdminService distributorGradeService;

    /**
     * 分销等级保存
     *
     * @param searchDto
     * @return
     */
    @PostMapping("/grade/save")
    public QResult save(@RequestBody @Validated DistributorGradeSaveDTO searchDto) {
        return QResult.success(distributorGradeService.save(searchDto));
    }

    /**
     * 分销等级列表
     *
     * @return
     */
    @PostMapping("/grade/list")
    public QResult list() {
        return QResult.success(distributorGradeService.list());
    }
}
